package com.lovo.bbs.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lovo.bbs.bean.Student;
import com.lovo.bbs.service.StudentService;
import com.lovo.bbs.dao.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author BDK-THINKPAD
* @description 针对表【t_student】的数据库操作Service实现
* @createDate 2023-07-26 13:51:47
*/
@Service
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student>
    implements StudentService{
    @Autowired
    private StudentMapper studentMapper;
    @Override
    public PageInfo<Student> listStudent(Integer current,Integer pageSize,Student student) {
        PageHelper.startPage(current,pageSize);
        if(student.getName() != null && !"".equals(student.getName())){
            student.setName("%" + student.getName() + "%");
        }
        List<Student> students = studentMapper.listStudent(student);
        return new PageInfo<>(students);
    }

    @Override
    public Student getById(Integer id) {
        return studentMapper.getById(id);
    }
}




